/*
 * @Author: liuYang codkly@gmail.com
 * @Date: 2022-12-05 17:23:28
 * @LastEditors: liuYang codkly@gmail.com
 * @LastEditTime: 2022-12-07 10:44:48
 * @FilePath: \coding\nest\blog_alpha\src\tag\tag.entity.ts
 * @Description:
 * 暂无备注
 */
import {
  Column,
  CreateDateColumn,
  DeleteDateColumn,
  Entity,
  ManyToMany,
  ManyToOne,
  OneToMany,
  PrimaryGeneratedColumn,
  JoinTable,
} from 'typeorm';
import { BaseEntity } from '../../entity/base.entity';
import { ArticleEntity } from "../article/article.entity";
@Entity('tag')
export class TagEntity extends BaseEntity {
  @Column({
    nullable: true,
    comment: '标签名字',
  })
  name: string;

  @Column({
    nullable: true,
    comment: '数量',
    default: () => 0,
  })
  count: number;
  // 多个标签一篇文章
  @ManyToMany(() => ArticleEntity, article => article.tags)
  articles:ArticleEntity[]
}
